const Mock = require("better-mock/dist/mock.mp.js");
Mock.mock("http://127.0.0.1:4523/api/test", "get", {
	'code': 200,
	'message': 'success',
	'data|4': [{
		'id|+1': 1,
		'title': '@cname',
		'text1':'588',
		'text2':'588',
		'text3':'5盒赠1盒+3支',
		'image': '@image("200x200")'
	}]
});

// 模拟下拉加载数据返回
Mock.mock('http://127.0.0.1:4523/api/loadmore', 'post', (options) => {
  const { page, pageSize } = options.body;
  const startIndex = (page - 1) * pageSize;
  const endIndex = page * pageSize;
  
  const data = Mock.mock({
    'list|10': [{
      'id|+1': 1,
      'title': '@cname',
      'text1':'588',
      'text2':'588',
      'text3':'5盒赠1盒+3支',
      'image': '@image("200x200")'
    }]
  });
  
  return {
    code: 200,
    message: 'success',
    data: data.list
  };
});